import React from "react";

class App extends React.Component{

    constructor(props) {
        console.log("botton.js", "constructor...",new Date().getTime());
        super(props);
        const students = [];
        for (const student of props.students) {
            students.push(student);
        }
        this.state = {
            num: props.num,
            fruit: Object.assign({},props.fruit),
            students,
            name: props.name
        }
    }

    // componentWillMount() {
    //     console.log("botton.js", "componentWillMount...",new Date().getTime());
    // }

    componentDidMount() {
        console.log("botton.js", "componentDidMount...",new Date().getTime());
    }

    componentDidUpdate(prevProps) {
        console.log("botton.js", "componentDidUpdate...",new Date().getTime(), prevProps);
    }

    componentWillUnmount() {
        console.log("botton.js", "componentWillUnmount...",new Date().getTime());
    }


    render() {
        return (
            <div className={"bottomApp"}>
                这是底部
                <br/>
                自己的num:{this.state.num}&nbsp;{this.state.fruit.name}&nbsp;
                颜色是：{this.state.fruit.color} 重量是：{this.state.fruit.weight} kg<br/>
                {this.state.students.join(" * ")}&nbsp;&nbsp;{this.state.name}
            </div>
        )
    }

}

export default App;

